UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gyZ7QSAS9f9YpVP0beVmUc4X6sUUYbju7F6V3ORtnmU=' 
WHERE 
  key_id = '1720d7acc550ad5d242536617232951b9a0b555e3aa7eb25d279f94cbf24d417' 
  AND (
    token = 'gyZ7QSAS9f9YpVP0beVmUc4X6sUUYbju7F6V3ORtnmU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054