UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zuO58y9IP4+/a2ASUYM+CFcPondllyWzgWWabso7IUM=' 
WHERE 
  key_id = 'eb217a3a4902bfd0f1d781405c36c7402b6764a275709a84687da1cb17c2f278' 
  AND (
    token = 'zuO58y9IP4+/a2ASUYM+CFcPondllyWzgWWabso7IUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043