UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lOQ0ZF5JTkhF93jp3hy2bRck2wOJtNUq7gMzBRxB+7U=' 
WHERE 
  key_id = '3b9bd7baa38a38ae16a1b29d8a67a62423787b5c3b0213127443128fd4cb6ff7' 
  AND (
    token = 'lOQ0ZF5JTkhF93jp3hy2bRck2wOJtNUq7gMzBRxB+7U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046