UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TZEtA1sqSN4gSFEt6zLo+aXjIoW5wCNgR5AqFd3fyxU=' 
WHERE 
  key_id = 'f6940748bd61d126da0c28630c749e4d48807416b6c4d8aca48a26404da91750' 
  AND (
    token = 'TZEtA1sqSN4gSFEt6zLo+aXjIoW5wCNgR5AqFd3fyxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020