UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EhgjNgxJ1gQR0Nkyp2aZ89fT4+efWfEct5cYQwbYPpQ=' 
WHERE 
  key_id = '47ff61d5b441df1ac9f25caac09959835d9dc138e26cd0e36f3fdb50f88db56f' 
  AND (
    token = 'EhgjNgxJ1gQR0Nkyp2aZ89fT4+efWfEct5cYQwbYPpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017