UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CnC0vUM8TZx1v8OAQ11qy00Lged34ml2PdivAYecqq4=' 
WHERE 
  key_id = '13992ffcc6691b93e15749a6d976daccad8426218cf9c6f9c6ca64a03640df28' 
  AND (
    token = 'CnC0vUM8TZx1v8OAQ11qy00Lged34ml2PdivAYecqq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025