UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oAZ5+Df5m7W09A9ttZ6NcX9nI1ZEuvQFEafyN8U9vtY=' 
WHERE 
  key_id = '04328d38ef1910e6e3b036b952fadff0132e74b52b0a6fa40a80d35d2ecd67f6' 
  AND (
    token = 'oAZ5+Df5m7W09A9ttZ6NcX9nI1ZEuvQFEafyN8U9vtY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051