UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mDTVve//6MV3EZSsg5KcGRyE9crfC7mmtkct9MmSS3w=' 
WHERE 
  key_id = 'e265c4b73f4376f0a44599a047afab22a3864faeb82693c34e17388c0a95a0ac' 
  AND (
    token = 'mDTVve//6MV3EZSsg5KcGRyE9crfC7mmtkct9MmSS3w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026