UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TL414FAlyaSEohliSYG8bGyr+7jZlksKTVnURO6mByY=' 
WHERE 
  key_id = 'd2e4b848ed6ce2ebbcb93e02e77eda88a360712aaa4516d9f150667bdd26513f' 
  AND (
    token = 'TL414FAlyaSEohliSYG8bGyr+7jZlksKTVnURO6mByY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031