UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IbiC57S2j22kNsp+9sg2PwMNPdqiqclZJfygOhkckm8=' 
WHERE 
  key_id = 'dd0ba8e8b21f0d6e054b4e352e9a5c0d940c4f3f415f8243bca1e2a0ba3769d9' 
  AND (
    token = 'IbiC57S2j22kNsp+9sg2PwMNPdqiqclZJfygOhkckm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041