UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'knOED12KY6LD+yJ77Sw7SFJBjjkLStEirRoz0hHTgeU=' 
WHERE 
  key_id = '991118073526a6b92ae1c1eb7b2830d6eda5cef5a9da4af8a432acc6bf779b7e' 
  AND (
    token = 'knOED12KY6LD+yJ77Sw7SFJBjjkLStEirRoz0hHTgeU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043