UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZbxTYrN7uHA4reJ9z0nweF6uZ+GQwdy8MtZgnrfgDeQ=' 
WHERE 
  key_id = 'c374dd84bac7a281f73eb47005a4b8e24ae6a8f69961b3c244e471cf342ffa4f' 
  AND (
    token = 'ZbxTYrN7uHA4reJ9z0nweF6uZ+GQwdy8MtZgnrfgDeQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027