UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eVyzClde3HSOFkVwnaLJz1BrUIFjM2QincsfmWXkVIM=' 
WHERE 
  key_id = 'a4ab3a06f67b7ca5479bda9323583f325da56695e3a82a3fa9ec1597672411c8' 
  AND (
    token = 'eVyzClde3HSOFkVwnaLJz1BrUIFjM2QincsfmWXkVIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032