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

Query time 0.00047