UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kJQrMoPXvdcotL005Sm7x5SLHXPc5PO8XlMXnIPEPso=' 
WHERE 
  key_id = '5b527b952c470e4bb619f78cdc57a7ea742707410d453a2161a4a749aacbfaf7' 
  AND (
    token = 'kJQrMoPXvdcotL005Sm7x5SLHXPc5PO8XlMXnIPEPso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037