UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '594kJDnHaGd9haNx8qDs56xyjwy4OENQ04UYqfFXvxU=' 
WHERE 
  key_id = '79367d80dbca20ddcb02f82b0d62d1249cfc45595ad03885cd6bfef38faacc2f' 
  AND (
    token = '594kJDnHaGd9haNx8qDs56xyjwy4OENQ04UYqfFXvxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032