UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CEtIyCwNs4Dtl6zuzhtaq38mhi7Py+27JlK1dUo7yqg=' 
WHERE 
  key_id = '0d4e46078d5c1eedb532c737c64bcd20b5ec6b9cac06b196286ccacb0b8a17f0' 
  AND (
    token = 'CEtIyCwNs4Dtl6zuzhtaq38mhi7Py+27JlK1dUo7yqg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017