UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KhlEH5g10aETDvxx6ht+WPfXuJ29Fn4mUpfTz5d13p4=' 
WHERE 
  key_id = '8a90f4f310d29b9a9026b384c04a22baaa6ce00d33163b6791bb9d5589bbc409' 
  AND (
    token = 'KhlEH5g10aETDvxx6ht+WPfXuJ29Fn4mUpfTz5d13p4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063