UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vUdVctgKpGKmSNA7lNCD0CuCCzVhfZwluMp2cy0lztY=' 
WHERE 
  key_id = '77dbca2dffaf3171a990c248326bcd4252d978ea2c79d6f974e863673305a58c' 
  AND (
    token = 'vUdVctgKpGKmSNA7lNCD0CuCCzVhfZwluMp2cy0lztY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042