UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V8N9l6mRyw5adRH2MreDzsWMsWgVY+sK+P7Ip4/j0Gk=' 
WHERE 
  key_id = '22e482842e41a4b6952816271b375203d70f5ca44353866ddd3c2538bafc8fb4' 
  AND (
    token = 'V8N9l6mRyw5adRH2MreDzsWMsWgVY+sK+P7Ip4/j0Gk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029