UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mSCOhNSoxGDF0nQshvgPQlCvYV5ZNu4OsObBOkFDBAg=' 
WHERE 
  key_id = '9ea13c1ce0b2875446a79a1a554b291d9a0e19d7d954a6cc2e1eb63bd8175099' 
  AND (
    token = 'mSCOhNSoxGDF0nQshvgPQlCvYV5ZNu4OsObBOkFDBAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038