UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7fjKrXQaHNJXy05YS0xHxBye6HLKjdDz4xIujPZQv2Y=' 
WHERE 
  key_id = '5a65c7d79e0d4f156c4aef6d634d74c6137b0bbf2e333998e0bbc6b0f8d7b31b' 
  AND (
    token = '7fjKrXQaHNJXy05YS0xHxBye6HLKjdDz4xIujPZQv2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038