UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FdkIH9Yp1v3/MCL0iU1R90dYR8YWoiNQIZW0m+OtPNo=' 
WHERE 
  key_id = 'ec97dde4caaa372425529792dc7ee37c594d70bb7c943a5d4b70fc37e7f26e20' 
  AND (
    token = 'FdkIH9Yp1v3/MCL0iU1R90dYR8YWoiNQIZW0m+OtPNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032