UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6bq619Q5s3eKeM90QSW8qf0Q1LrFm9bDUrNFXnqYDIU=' 
WHERE 
  key_id = '8b27d5692fccfe02bd3a8b35b645474af1b16434aac8f0fd71e8a13e7fd8977d' 
  AND (
    token = '6bq619Q5s3eKeM90QSW8qf0Q1LrFm9bDUrNFXnqYDIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047