UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bqM/+uu/7T8X2fKozdedecMDiWxJGJFUb60tmmK7dO0=' 
WHERE 
  key_id = '8066abcd96cb1b66143c5b78f3b7661172b7639a380baf29c65d9c416bed9fd4' 
  AND (
    token = 'bqM/+uu/7T8X2fKozdedecMDiWxJGJFUb60tmmK7dO0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039