UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/GfOz43VCq0mP/RZQwGobs8BGWGfep4B4c1qGg17ul8=' 
WHERE 
  key_id = 'd605ccac832aed28aab18a421cd4222628ad876ce96e6b54681a36d0bbea64b1' 
  AND (
    token = '/GfOz43VCq0mP/RZQwGobs8BGWGfep4B4c1qGg17ul8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034