UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8mc/KL2tK5iwYqJfvJJgB7xvMvsPbTx5oP2uJPa/dgI=' 
WHERE 
  key_id = '6db664bc8313af5b9bc7e4ccd8ed32d47940265322cfde521dccc2382a536369' 
  AND (
    token = '8mc/KL2tK5iwYqJfvJJgB7xvMvsPbTx5oP2uJPa/dgI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037