UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gfV3UUf1MqwCiXKRwfcD6Mt2PxISmw6z1vUIxjeK/z4=' 
WHERE 
  key_id = '644d9345a90e8362d2e29e3d95e017b7187325dd22f015bc131e4b2665b904d8' 
  AND (
    token = 'gfV3UUf1MqwCiXKRwfcD6Mt2PxISmw6z1vUIxjeK/z4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030