UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LCE3xVrK3V9KMwUGkHrtrzMmZ5ZxWDt3pHM4RRHYTR8=' 
WHERE 
  key_id = '9336df3623b125ea25c167ac3159235052c4972cfe6bb2214f83d29a7070e7ac' 
  AND (
    token = 'LCE3xVrK3V9KMwUGkHrtrzMmZ5ZxWDt3pHM4RRHYTR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016