UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DumHsHlzL5S99ZW9I8ur9t7R0XqYoVXUtPXqUsyjoHo=' 
WHERE 
  key_id = '327a052a9464a251dde13c50b6ef2f8e40e3adbda939b23899833eb15c8f262f' 
  AND (
    token = 'DumHsHlzL5S99ZW9I8ur9t7R0XqYoVXUtPXqUsyjoHo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052