UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lUXFMyqCVTEDCp07x5dtWuy6NqEsxZB3StUEwPjRDbg=' 
WHERE 
  key_id = '47a3e771b42cdb86970f8897f7df7d7380ceb2e9408a6be6f61e0116d43df273' 
  AND (
    token = 'lUXFMyqCVTEDCp07x5dtWuy6NqEsxZB3StUEwPjRDbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038