UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'txtruA5V+eNDBknHOsutT7n1MjIc6hEwApl/TbdY+3E=' 
WHERE 
  key_id = 'ed7ed91b3bb7453f301809a03512bac3e3e5fd12b6439e31a24ac0f32df51bf4' 
  AND (
    token = 'txtruA5V+eNDBknHOsutT7n1MjIc6hEwApl/TbdY+3E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045