UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RN1PyTkS9zpnHDFsVdUFUx26WndSDIWYD2wBKvfOHHI=' 
WHERE 
  key_id = '3a5acb4f2cc20b156f1e73afe9e1c001a13a3e163ea1847a6193a70f243d9ba6' 
  AND (
    token = 'RN1PyTkS9zpnHDFsVdUFUx26WndSDIWYD2wBKvfOHHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027