UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S6yYN+7RRMUPJU3AtttCQYMleZCF2CQ3WK8I9x+NYxE=' 
WHERE 
  key_id = '6740b06e04942fe43b74c591144a89b5898ad9905c28b4f21d38e0f8925cc01e' 
  AND (
    token = 'S6yYN+7RRMUPJU3AtttCQYMleZCF2CQ3WK8I9x+NYxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022