UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ax35gFPzT5LjLsN3PnV4XqXc+71wa2raGKJuCuiMhHU=' 
WHERE 
  key_id = '80ce31afb27986b95eba307cf6b181440c67cfbf3f9bbc54cb909feaa046f545' 
  AND (
    token = 'Ax35gFPzT5LjLsN3PnV4XqXc+71wa2raGKJuCuiMhHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061