UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3NbtYmR3jX0ZZvwGSzQ9y3hSOmWTUbzi/v4BvsBJUeA=' 
WHERE 
  key_id = 'a936072831790be5857216539df8eecd15fd47eaebcc69f241ba450f31467a3d' 
  AND (
    token = '3NbtYmR3jX0ZZvwGSzQ9y3hSOmWTUbzi/v4BvsBJUeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040